package de.unibi.comet.hmm;

import java.util.Iterator;

/** Represents a joined distribution of states and accumulated masses
 *  of an HHM. */
public interface StateAndMassDistribution {
	
	/** Returns the probablity of being in given state and having 
	 *  accumulated a given mass. */
	double get(int state, int mass);

	/** Set probability. */
	void set(int state, int mass, double p);
	
	/** Add probability to specified entry. */
	void add(int state, int mass, double p);
	
	/** Creates a clone of itself but resets probabilities to zero. */ 
	StateAndMassDistribution emptyClone();
	
	/** Returns the mass distribution for a single state by means
	 *  of an iterator. */
	Iterator<Emission> getMassDistribution(int state);
	
	/** Calculates probability of having accumulated given mass. */
	double getMassProbability(int mass);

	/** Calculates probability of being in given state. */
	double getStateProbability(int state);

	/** Returns number of states. */
	int getStateCount();

	/** Returns maximal mass. */
	int getMaxMass();

	/** Returns a bound for the maximal mass. If that bound is reached, table
	 *  will not grow any further.
	 *  @return Returns -1 if no such bound exists.
	 */
	int getMassBound();
	
	/** Returns true, if probabilities are stored logarithmic in this table. */
	boolean isLogarithmic();
	
	/** Calculates distribution of states. */
	double[] getStateDistribution();
}